package main.java.DMDE.model;

import java.util.*;

/**
 * Class Project
 */
public class Project {

	private List<Diagram> diagrams;
	private List<Entity> entities;
	private String name;
	
	public Project(String name) {
		setDiagrams(new ArrayList<Diagram>());
		setEntities(new ArrayList<Entity>());
		this.setName(name);
	}

	public List<Entity> getEntities() {
		return entities;
	}

	public void addEntity(Entity entity) {
		if (!containsEntity(entity)) {
			entities.add(entity);
		}
	}

	private boolean containsEntity(Entity entity) {
		return entities.contains(entity);
	}

	public void removeEntity(Entity entity) {
		entities.remove(entity);
	}
	
	public void addDiagram(Diagram diagram) {
		if (!containsDiagram(diagram)) {
			diagrams.add(diagram);
		}
	}
	
	private boolean containsDiagram(Diagram diagram) {
		return diagrams.contains(diagram);
	}

	public void removeDiagrma(Diagram diagram) {
		diagrams.remove(diagram);
	}
	
	public void setEntities(List<Entity> entities) {
		this.entities = entities;
	}

	public List<Diagram> getDiagrams() {
		return diagrams;
	}

	public void setDiagrams(List<Diagram> diagrams) {
		this.diagrams = diagrams;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int diagramsCount() {
		return this.diagrams.size();
	}

	public int entitiesCount() {
		return this.entities.size();
	};
}
